package com.banyuan.controller;

import com.banyuan.domain.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class AjaxController {

    @RequestMapping("/ajax")
    @ResponseBody
    public Person ajax( Person person) {
        System.out.println("接受前端的对象" + person);
        person.setName("lisi");
        System.out.println("发送给前端的json对象" + person);
        return person;
    }


    @RequestMapping("/ajax1")
    @ResponseBody
    public Person ajax1(@RequestBody Person person) {
        System.out.println("接受前端的json对象" + person);
        person.setName("lisi");
        System.out.println("发送给前端的json对象" + person);
        return person;
    }
}
